<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>while实现1-100相加求和</title>
</head>
<body>
    <script>
        var total=0;
        var a=1;
        while(a<=100){  
            total+=a;
            a++;
            document.write(total+",")
        }
    </script>
</body>
</html>